<template>
  <div id="app">
    <h1>在线翻译</h1>
    <h5>简单 / 易用 / 便捷</h5>
    <translate-form v-on:formSubmit="translate"/>
    <translate-output v-bind:resultText="resultText"/>
  </div>
</template>

<script>
  import TranslateForm from './components/TranslateForm'
  import TranslateOutput from './components/TranslateOutput'

  export default {
    name: 'App',
    data: function () {
      return {
        resultText: ""
      }
    },
    components: {
      TranslateForm,
      TranslateOutput
    },
    methods: {
      translate: function (textToTranslate, language) {
        // this.$http.get('http://www.baidu.com').then(resp => {
        //   this.resultText = textToTranslate + " => " + language;
        // });
        this.resultText = textToTranslate + " => " + language;
      }
    }
  }
</script>

<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }
</style>
